1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module adw.EnumListModel;
26 
27 private import adw.c.functions;
28 public  import adw.c.types;
29 private import gio.ListModelIF;
30 private import gio.ListModelT;
31 private import glib.ConstructionException;
32 private import gobject.ObjectG;
33 
34 
35 /**
36  * A [iface@Gio.ListModel] representing values of a given enum.
37  * 
38  * `AdwEnumListModel` contains objects of type [class@EnumListItem].
39  *
40  * Since: 1.0
41  */
42 public class EnumListModel : ObjectG, ListModelIF
43 {
44 	/** the main Gtk struct */
45 	protected AdwEnumListModel* adwEnumListModel;
46 
47 	/** Get the main Gtk struct */
48 	public AdwEnumListModel* getEnumListModelStruct(bool transferOwnership = false)
49 	{
50 		if (transferOwnership)
51 			ownedRef = false;
52 		return adwEnumListModel;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected override void* getStruct()
57 	{
58 		return cast(void*)adwEnumListModel;
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (AdwEnumListModel* adwEnumListModel, bool ownedRef = false)
65 	{
66 		this.adwEnumListModel = adwEnumListModel;
67 		super(cast(GObject*)adwEnumListModel, ownedRef);
68 	}
69 
70 	// add the ListModel capabilities
71 	mixin ListModelT!(AdwEnumListModel);
72 
73 
74 	/** */
75 	public static GType getType()
76 	{
77 		return adw_enum_list_model_get_type();
78 	}
79 
80 	/**
81 	 * Creates a new `AdwEnumListModel` for @enum_type.
82 	 *
83 	 * Params:
84 	 *     enumType = the type of the enum to construct the model from
85 	 *
86 	 * Returns: the newly created `AdwEnumListModel`
87 	 *
88 	 * Since: 1.0
89 	 *
90 	 * Throws: ConstructionException GTK+ fails to create the object.
91 	 */
92 	public this(GType enumType)
93 	{
94 		auto __p = adw_enum_list_model_new(enumType);
95 
96 		if(__p is null)
97 		{
98 			throw new ConstructionException("null returned by new");
99 		}
100 
101 		this(cast(AdwEnumListModel*) __p, true);
102 	}
103 
104 	/**
105 	 * Finds the position of a given enum value in @self.
106 	 *
107 	 * Params:
108 	 *     value = an enum value
109 	 *
110 	 * Since: 1.0
111 	 */
112 	public uint findPosition(int value)
113 	{
114 		return adw_enum_list_model_find_position(adwEnumListModel, value);
115 	}
116 
117 	/**
118 	 * Gets the type of the enum represented by @self.
119 	 *
120 	 * Returns: the enum type
121 	 *
122 	 * Since: 1.0
123 	 */
124 	public GType getEnumType()
125 	{
126 		return adw_enum_list_model_get_enum_type(adwEnumListModel);
127 	}
128 }